package com.sdx.console.transaction.entity;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

import com.sdx.common.utils.Utils;
import org.beetl.sql.core.annotatoin.*;

import com.ibeetl.admin.core.util.ValidateConfig;

import org.beetl.sql.core.TailBean;
import java.math.*;

import com.ibeetl.admin.core.annotation.Dict;
import com.ibeetl.admin.core.entity.BaseEntity;

import com.fasterxml.jackson.annotation.JsonIgnore;


/*
*
* gen by Spring Boot2 Admin 2018-08-30
*/
public class FinTransaction extends BaseEntity{

    @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class)
    @AssignID
    private String transactionId ;

    //本平台用户id，或者就是个手机号

    private String userId ;

    private Integer tenantId;

    //订单id，或商品id

    private String orderId ;

    //订单类型，1、一对一合同；2、购买作文；3、按分数查看院校
    private Integer orderType ;

    //支付类型，1、微信h5支付；2、微信公众号支付；3、微信小程序支付；4、微信扫码支付；11、支付宝h5支付；21、银联支付
    @Dict(type="PAY_METHOD")
    private Integer payMethod ;


    private String appId ;


    private String merchantId ;

    //账户账号，微信没有

    private String merchantAccount ;

    //购买者id，微信支付方式就是对应appid的openid，支付宝支付是buyer_id

    private String consumerId ;

    //购买者账号，微信没有

    private String consumerAccount ;


    private String tradeNo ;

    //交易金额，单位是分

    private Long totalMoney ;

    //支付状态，0、未支付；1、确认中；2、已支付；3、退款确认中；4、已退款

	@Dict(type="PAY_FLAG")
    private Integer payFlag ;


    private Date createTime ;


    private Date payTime ;


    private Date refundTime ;


    private String refundId ;


    private String tradeMemo ;


    private String callback ;


    private String comefrom ;


    private String errorJson ;

    private String channel;

    private String phone;

    private String orderName;

    private String channelName;

    private String customerId;

    private String orderNo;

    private Integer provinceId;

    private Integer payType;

    private String bdOrder;

    public String getBdOrder() {
        return bdOrder;
    }

    public void setBdOrder(String bdOrder) {
        this.bdOrder = bdOrder;
    }

    public FinTransaction()
    {
    }

    public String getTransactionId(){
	    return  transactionId;
    }
    public void setTransactionId(String transactionId){
        this.transactionId = transactionId;
    }

    /**本平台用户id，或者就是个手机号
    *@return
    */
    public String getUserId(){
	    return  userId;
    }
    /**本平台用户id，或者就是个手机号
    *@param  userId
    */
    public void setUserId(String userId){
        this.userId = userId;
    }

    /**订单id，或商品id
    *@return
    */
    public String getOrderId(){
	    return  orderId;
    }
    /**订单id，或商品id
    *@param  orderId
    */
    public void setOrderId(String orderId){
        this.orderId = orderId;
    }

    /**订单类型，1、一对一合同；2、购买作文；3、按分数查看院校
    *@return
    */
    public Integer getOrderType(){
	    return  orderType;
    }
    /**订单类型，1、一对一合同；2、购买作文；3、按分数查看院校
    *@param  orderType
    */
    public void setOrderType(Integer orderType){
        this.orderType = orderType;
    }

    /**支付类型，1、微信h5支付；2、微信公众号支付；3、微信小程序支付；4、微信扫码支付；11、支付宝h5支付；21、银联支付
    *@return
    */
    public Integer getPayMethod(){
	    return  payMethod;
    }
    /**支付类型，1、微信h5支付；2、微信公众号支付；3、微信小程序支付；4、微信扫码支付；11、支付宝h5支付；21、银联支付
    *@param  payMethod
    */
    public void setPayMethod(Integer payMethod){
        this.payMethod = payMethod;
    }

    public String getAppId(){
	    return  appId;
    }
    public void setAppId(String appId){
        this.appId = appId;
    }

    public String getMerchantId(){
	    return  merchantId;
    }
    public void setMerchantId(String merchantId){
        this.merchantId = merchantId;
    }

    /**账户账号，微信没有
    *@return
    */
    public String getMerchantAccount(){
	    return  merchantAccount;
    }
    /**账户账号，微信没有
    *@param  merchantAccount
    */
    public void setMerchantAccount(String merchantAccount){
        this.merchantAccount = merchantAccount;
    }

    /**购买者id，微信支付方式就是对应appid的openid，支付宝支付是buyer_id
    *@return
    */
    public String getConsumerId(){
	    return  consumerId;
    }
    /**购买者id，微信支付方式就是对应appid的openid，支付宝支付是buyer_id
    *@param  consumerId
    */
    public void setConsumerId(String consumerId){
        this.consumerId = consumerId;
    }

    /**购买者账号，微信没有
    *@return
    */
    public String getConsumerAccount(){
	    return  consumerAccount;
    }
    /**购买者账号，微信没有
    *@param  consumerAccount
    */
    public void setConsumerAccount(String consumerAccount){
        this.consumerAccount = consumerAccount;
    }

    public String getTradeNo(){
	    return  tradeNo;
    }
    public void setTradeNo(String tradeNo){
        this.tradeNo = tradeNo;
    }

    /**交易金额，单位是分
    *@return
    */
    public Long getTotalMoney(){
	    return  totalMoney;
    }
    /**交易金额，单位是分
    *@param  totalMoney
    */
    public void setTotalMoney(Long totalMoney){
        this.totalMoney = totalMoney;
    }

    /**支付状态，0、未支付；1、确认中；2、已支付；3、退款确认中；4、已退款
    *@return
    */
    public Integer getPayFlag(){
	    return  payFlag;
    }
    /**支付状态，0、未支付；1、确认中；2、已支付；3、退款确认中；4、已退款
    *@param  payFlag
    */
    public void setPayFlag(Integer payFlag){
        this.payFlag = payFlag;
    }

    public Date getCreateTime(){
	    return  createTime;
    }
    public void setCreateTime(Date createTime){
        this.createTime = createTime;
    }

    public Date getPayTime(){
	    return  payTime;
    }
    public void setPayTime(Date payTime){
        this.payTime = payTime;
    }

    public Date getRefundTime(){
	    return  refundTime;
    }
    public void setRefundTime(Date refundTime){
        this.refundTime = refundTime;
    }

    public String getRefundId(){
	    return  refundId;
    }
    public void setRefundId(String refundId){
        this.refundId = refundId;
    }

    public String getTradeMemo(){
	    return  tradeMemo;
    }
    public void setTradeMemo(String tradeMemo){
        this.tradeMemo = tradeMemo;
    }

    public String getCallback(){
	    return  callback;
    }
    public void setCallback(String callback){
        this.callback = callback;
    }

    public String getComefrom(){
	    return  comefrom;
    }
    public void setComefrom(String comefrom){
        this.comefrom = comefrom;
    }

    public String getErrorJson(){
	    return  errorJson;
    }
    public void setErrorJson(String errorJson){
        this.errorJson = errorJson;
    }
	@ColumnIgnore
	@JsonIgnore
	private String createTimeQuery;
	@ColumnIgnore
	@JsonIgnore
	private Date createTimeStart;
	@ColumnIgnore
	@JsonIgnore
	private Date createTimeEnd;
	public String getCreateTimeQuery(){
		return  createTimeQuery;
	}
	public void setCreateTimeQuery(String createTimeQuery ){
		this.createTimeQuery = createTimeQuery;
		Date[] timePair = Utils.parseQueryTime(createTimeQuery);
		if (timePair!=null && timePair[0]!=null) {
			this.createTimeStart = timePair[0];
		}
		if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
			this.createTimeEnd = timePair[1];
		}
	}
	public Date getCreateTimeStart(){
		return  createTimeStart;
	}
	public void setCreateTimeStart(Date createTimeStart ){
		this.createTimeStart = createTimeStart;
	}
	public Date getCreateTimeEnd(){
		return  createTimeEnd;
	}
	public void setCreateTimeEnd(Date createTimeEnd ){
		this.createTimeEnd = createTimeEnd;
	}
	@ColumnIgnore
	@JsonIgnore
	private String refundTimeQuery;
	@ColumnIgnore
	@JsonIgnore
	private Date refundTimeStart;
	@ColumnIgnore
	@JsonIgnore
	private Date refundTimeEnd;
	public String getRefundTimeQuery(){
		return  refundTimeQuery;
	}
	public void setRefundTimeQuery(String refundTimeQuery ){
		this.refundTimeQuery = refundTimeQuery;
		Date[] timePair = Utils.parseQueryTime(refundTimeQuery);
		if (timePair!=null && timePair[0]!=null) {
			this.refundTimeStart = timePair[0];
		}
		if (timePair!=null && timePair.length==2 && timePair[1]!=null) {
			this.refundTimeEnd = timePair[1];
		}
	}
	public Date getRefundTimeStart(){
		return  refundTimeStart;
	}
	public void setRefundTimeStart(Date refundTimeStart ){
		this.refundTimeStart = refundTimeStart;
	}
	public Date getRefundTimeEnd(){
		return  refundTimeEnd;
	}
	public void setRefundTimeEnd(Date refundTimeEnd ){
		this.refundTimeEnd = refundTimeEnd;
	}

    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    public Integer getTenantId() {
        return tenantId;
    }

    public void setTenantId(Integer tenantId) {
        this.tenantId = tenantId;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getOrderName() {
        return orderName;
    }

    public void setOrderName(String orderName) {
        this.orderName = orderName;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public Integer getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(Integer provinceId) {
        this.provinceId = provinceId;
    }

    public Integer getPayType() {
        return payType;
    }

    public void setPayType(Integer payType) {
        this.payType = payType;
    }
}
